package com.coderli.onecoder.server.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.coderli.onecoder.shared.model.AgentInfo;
import com.coderli.onecoder.shared.model.AgentResponse;

/**
 * 提供Handler对象的工厂，根据传入的实体不同，产生不同的对象
 * 
 * @author lihzh
 * @date 2012-7-6 下午3:26:50
 */
public class HandlerFactory {
	
	private static final Logger log = LoggerFactory.getLogger(HandlerFactory.class);

	/**
	 * 获取具体的Handleer
	 * 
	 * @param obj
	 * @return
	 * @author lihzh
	 * @date 2012-7-6 下午3:51:57
	 */
	public static AgentMessageHandler getMessageHandler(Object obj) {
		if (obj == null) {
			log.warn("The message from agent is null, nothing to do.");
		}
		if (obj instanceof AgentInfo) {
			return new AgentInfoHandler();
		} else if (obj instanceof AgentResponse) {
			return null;
		}
		return null;
	}

}
